//
//  MainViewController.m
//  WuLi
//
//  Created by Gollum on 16/8/29.
//  Copyright © 2016年 Gollum. All rights reserved.
//

#import "MainViewController.h"
#import "HomePageViewController.h"
#import "HotspotViewController.h"
#import "InteractionViewController.h"
#import "MineViewController.h"
#import "AdvertiseViewController.h"
@interface MainViewController ()

@end

@implementation MainViewController

- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil{

    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        self.viewControllers = [self createTabBar];
        [[UITabBar appearance] setTintColor:[UIColor orangeColor] ];
        //[[UITabBar appearance] setBarTintColor:[UIColor yellowColor] ];
    }
    return self;
}

- (NSArray <UIViewController *>*)createTabBar{
    
    //创建 一系列的ViewController
    NSMutableArray *VCArray = [NSMutableArray array];
    //首页
    HomePageViewController *homePage = [[HomePageViewController alloc] init];
//    homePage.view.backgroundColor = [UIColor magentaColor];
    homePage.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"首页" image:[UIImage imageNamed:@"shouye_normal"] selectedImage:[UIImage imageNamed:@"shouye_heighlight"]];
    //热门
    HotspotViewController *hotspot = [[HotspotViewController alloc] init];
//    hotspot.view.backgroundColor = [UIColor greenColor];
    hotspot.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"热吧" image:[UIImage imageNamed:@"remen_normal"] selectedImage:[UIImage imageNamed:@"remen_heighlight"]];
    //互动
    InteractionViewController *interaction = [[InteractionViewController alloc] init];
//    interaction.view.backgroundColor = [UIColor orangeColor];
    interaction.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"V社区" image:[UIImage imageNamed:@"hudong_normal"] selectedImage:[UIImage imageNamed:@"hudong_heighlight"]];
    //我的
    MineViewController *mine = [[MineViewController alloc] init];
//    mine.view.backgroundColor = [UIColor yellowColor];
    mine.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"我的" image:[UIImage imageNamed:@"wode_normal"] selectedImage:[UIImage imageNamed:@"wode_heighlight"]];
    VCArray = @[homePage,hotspot,interaction,mine].mutableCopy;
    
    return VCArray;

}

- (void)viewDidLoad {
    [super viewDidLoad];
 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pushToAd) name:@"pushtoad" object:nil];
}
- (void)pushToAd {
    
    AdvertiseViewController *adVc = [[AdvertiseViewController alloc] init];
    [self.navigationController pushViewController:adVc animated:YES];
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    
    
    
}


@end
